package org.melanesia.beans.exceptions;

/**
 * Thrown from the bean mapper framework, when null value is being casted to a
 * primitive type. This exception is thrown to avoid NPEs during autounboxing of
 * null values.
 * 
 * In such situation there is a NPE thrown "out of nowhere" which can cause
 * confusion. Melanesia takes care of it, throwing
 * <code>NullCastToPrimitiveTypeException</code> before it happens.
 * 
 * @author marcin.kielar
 */
public class NullCastToPrimitiveTypeException extends Exception {

    /** Serial version uid for serialization. */
    private static final long serialVersionUID = 62561215215313091L;

    /**
     * Constructs new {@link NullCastToPrimitiveTypeException}.
     * 
     * @param toClass
     *            - the class that the null value was being casted to
     */
    public NullCastToPrimitiveTypeException(final Class<?> toClass) {
        super(String.valueOf(toClass));
    }

}
